<%@ include file="../inc/common.jsp"%>
<!DOCTYPE HTML>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<title>添加学生</title>
</head>
<body>
<div class="pd-20">
	<form action="/student/new.htm" method="post" class="form form-horizontal" id="form-admin-add">
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red">*</span>姓名：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" value="" placeholder="" id="student.name" name="student.name" datatype="*2-16" nullmsg="姓名不能为空">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red">*</span>登录名：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" value="" placeholder="" id="student.username" name="student.username" datatype="*2-16" nullmsg="用户名不能为空">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red">*</span>初始密码：</label>
			<div class="formControls col-5">
				<input type="password" name="student.password" placeholder="密码" autocomplete="off" value="111111" class="input-text" datatype="*6-20" nullmsg="密码不能为空">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red">*</span>确认密码：</label>
			<div class="formControls col-5">
				<input type="password" placeholder="确认新密码" autocomplete="off" value="111111" class="input-text Validform_error" errormsg="您两次输入的新密码不一致！" datatype="*" nullmsg="请再输入一次新密码！" recheck="student.password" >
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red">*</span>性别：</label>
			<div class="formControls col-5 skin-minimal">
				<div class="radio-box">
					<input type="radio" id="sex-1" name="sex" datatype="*" nullmsg="请选择性别！" value="男">
					<label for="sex-1">男</label>
				</div>
				<div class="radio-box">
					<input type="radio" id="sex-2" name="sex" value="女">
					<label for="sex-2">女</label>
				</div>
				<input type="hidden" name="student.gender"  id="gender"/>
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red">*</span>手机：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" value="" placeholder="" id="student.telephone" name="student.telephone"  datatype="m" nullmsg="手机不能为空">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red">*</span>邮箱：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" placeholder="@" name="student.email" id="student.email" datatype="e" nullmsg="请输入邮箱！">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3">院系：</label>
			<div class="formControls col-5"> <span class="select-box" style="width:150px;">
				<select class="select"  id="dp" size="1" onchange="setDapartmentName(this)">
					<s:iterator value="departments" >
						<option value="${id}_${name}">${name}</option>
					</s:iterator>
				</select>
				<input type="hidden" name="student.departmentName" id="departmentName" value=""/>
				<input type="hidden" name="student.departmentId" id="departmentId" value=""/>
				</span> </div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-3">专业：</label>
			<div class="formControls col-5"> <span class="select-box" style="width:150px;">
				<select class="select" id="ts" size="1" onchange="setTitle2(this)">
					<s:iterator value="majors">
						<option value="${code}_${name}">${name}</option>
					</s:iterator>
				</select>
				<input type="hidden" name="student.professionId" id="professionId" value=""/>
				<input type="hidden" name="student.professionName" id="professionName" value=""/>
				</span> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red"></span>家庭地址：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" value="" placeholder="" id="student.detailAddress" name="student.detailAddress" >
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3">备注：</label>
			<div class="formControls col-5">
				<textarea name="student.note" cols="" rows="" class="textarea"  placeholder="" dragonfly="true" onKeyUp="textarealength(this,100)"></textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<div class="col-9 col-offset-3">
				<input id="submit" class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-admin-add").Validform({
		tiptype:2,
		callback:function(form){
			form[0].submit();
			$("#submit")[0].disabled=true;
		}
	});
});

$("input[name=sex]").change(function(){
	$("#gender").val($(this).val());
});


$(function(){
	var dp = $("#dp")[0];
	var title = $("#ts")[0];
	setDapartmentName(dp);
	setTitle2(title);
});
function setDapartmentName(obj)
{
	var opt = obj.value;
	var arr = new Array();
	arr = opt.split("_");
	$("#departmentId").val(arr[0]);
	$("#departmentName").val(arr[1]);
}

function setTitle2(obj)
{
	var opt = obj.value;
	var arr = new Array();
	arr = opt.split("_");
	$("#professionId").val(arr[0]);
	$("#professionName").val(arr[1]);
}
</script>
</body>
</html>